package com.java1412;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * @author java1412
 * @since 2024-04-01 14:07:39
 */
@SpringBootApplication
@EnableEurekaClient // 开启eureka的客户端
@EnableDiscoveryClient  // 开启服务发现
@EnableFeignClients // 开启feign的客户都安
public class ServiceFeignApplication {
    public static void main(String[] args) {
        SpringApplication.run(ServiceFeignApplication.class, args);
    }

    @Bean
    public IRule iRule() {
        return new RandomRule(); // 注册负载均衡器
    }
}
